// 模拟数据
export let mockData = [
    {
      id: 1,
      name: '泰山刻石',
      type: 'inscription',
      dynasty: 'qin',
      location: '山东省泰安市泰山',
      author: '李斯'
    },
    {
      id: 2,
      name: '张迁碑',
      type: 'stele',
      dynasty: 'han',
      location: '陕西省西安市碑林博物馆',
      author: '张迁'
    },
    {
      id: 3,
      name: '乾隆御碑',
      type: 'stele',
      dynasty: 'qing',
      location: '北京故宫博物院',
      author: '乾隆帝'
    }
  ]
  
  // 模拟 API 响应
  export function mockGetLocations(params = {}) {
    return new Promise((resolve) => {
      setTimeout(() => {
        // 过滤数据
        let filteredData = [...mockData]
        
        if (params.name) {
          filteredData = filteredData.filter(item => 
            item.name.toLowerCase().includes(params.name.toLowerCase())
          )
        }
        
        if (params.type) {
          filteredData = filteredData.filter(item => 
            item.type === params.type
          )
        }
        
        if (params.dynasty) {
          filteredData = filteredData.filter(item => 
            item.dynasty === params.dynasty
          )
        }
        
        if (params.location) {
          filteredData = filteredData.filter(item => 
            item.location.toLowerCase().includes(params.location.toLowerCase())
          )
        }
  
        if (params.author) {
          filteredData = filteredData.filter(item => 
            item.author.toLowerCase().includes(params.author.toLowerCase())
          )
        }
  
        resolve({
          code: 0,
          data: filteredData,
          message: 'success',
          total: filteredData.length
        })
      }, 500)
    })
  }
  
  export function mockDeleteLocation(id) {
    return new Promise((resolve) => {
      setTimeout(() => {
        // 模拟删除操作
        mockData = mockData.filter(item => item.id !== id)
        resolve({
          code: 0,
          message: 'success',
          data: { deletedId: id }
        })
      }, 500)
    })
  }